/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Server;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 *
 * @author Fco. Molpeceres Blázquez
 */
public class ConfigReader {
    
    static String puerto;
    
    final String rutaFichero = "ConfigServer.cfg";
    FileReader lectorFichero;
    BufferedReader bufferLectura;
    File ficheroLectura;
    String cadenaLeida;
    String indice;
    
    public ConfigReader(){
        ficheroLectura = new File(rutaFichero);
        if(ficheroLectura.exists()){
            try{
                lectorFichero = new FileReader(ficheroLectura);
                bufferLectura = new BufferedReader(lectorFichero);
                try{
                    while((cadenaLeida = bufferLectura.readLine()) != null){
                        if(cadenaLeida.equals("#Puerto")){
                            puerto = bufferLectura.readLine();
                        }
                    }
                }catch(IOException ioe){
                    ioe.printStackTrace();
                }
            }catch(FileNotFoundException fnfe){
                fnfe.printStackTrace();
            }
        }
    }
    
}
